import React, { Component } from 'react'

export default class index extends Component {
    // constructor(props) {
    //     super(props);
    // }
    render() {
        return (
            <ul className="todo-main">
                {
                    this.props.list.map((item) => {
                        return (
                            <li key={item.id} onMouseEnter={() => { this.props.changeShow(true, item) }} onMouseLeave={() => { this.props.changeShow(false, item) }}>
                                <label>
                                    <input type="checkbox" defaultChecked={item.check} onChange={(e) => { this.props.changeData(item, e) }} />
                                    <span>{item.name}</span>
                                </label>
                                <button className="btn btn-danger" style={{ display: item.show ? 'block' : 'none' }} onClick={()=>{this.props.delData(item)}}>删除</button>
                            </li>
                        )
                    })
                }
            </ul>
        )
    }
}
